﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Net.Mail;
using MegaBitProject.Controllers;
using System.Configuration;

namespace MegaBitProject.Logging
{
    public class EmailLogMedia : LogMedia
    {
        public override void LogMessage(string message)
        {
            try
            {
                using (MailMessage mail = new MailMessage())
                {
                    string email = ConfigurationManager.AppSettings["Email"];

                    mail.To.Add(email);
                    mail.Subject = "Ban User";
                    mail.Body = message;
                    using (SmtpClient client = new SmtpClient())
                    {
                        client.EnableSsl = true;
                        client.Send(mail);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
    }
}